<div id="topbar">
<%
  controller = request.path_parameters['controller']
  action = request.path_parameters['action']
  url = "/" + controller + "/" + action
  links = []
  # links is an array of triplets: [action, nice title, controller]
%>
  <%if session['team'] %>
    <div id="nav">
    <%
    if session['team'].is_admin == true
      links = [ ["submissions","All Uploads","admin"], ["problems","Problems","admin"], ["teams","Teams","admin"], ["scores","Scores","submit"] ]
    else
      links = [ ["submit","Upload","submit"], ["submissions","Submissions","submit"], ["scores","Scores","submit"] ]
    end
    %>
    <%for key in links %>
      <%if action == key[0]%>
        <div id="current">
      <% end %>
      <%=link_to key[1], :controller => key[2], :action => key[0] %>
      <%if action == key[0]%>
        </div>
      <% end %>
    <%end%>
    </div>
    <div id="usercontrols">
      <%=link_to "Logout", :controller => "team", :action => "logout"%>
    </div>
  <%else%>
    <div id="nav">
    </div>
    <div id="usercontrols">
      <%=link_to "Login", :controller => "team", :action => "login"%> 
    </div>
  <%end%>
</div>
